git clone https://github.com/luarocks/luarocks.git
cd luarocks
./configure --lua-suffix=jit --with-lua-include=/usr/local/nginx/luajit/include/luajit-2.1/ --with-lua-lib=/usr/local/nginx/luajit/lib/ --prefix=/usr/local/luarocks --with-lua-bin=/usr/local/nginx/luajit/bin/

make install

/usr/local/luarocks/bin/luarocks install lua-cjson

ln -s /usr/local/nginx/luajit/lib/libluajit-5.1.a /usr/local/nginx/luajit/lib/liblua.a
ln -s /usr/local/nginx/luajit/lib/libluajit-5.1.so /usr/local/nginx/luajit/lib/liblua.so

# lua dir /usr/local/share/lua/5.1/
# so dir /usr/local/nginx/luajit/lib/lua/5.1/

#so 
rm -rf  /usr/local/nginx/luajit/lib/lua/5.1/
ln -sf   /usr/local/luarocks/lib/lua/5.1 /usr/local/nginx/luajit/lib/lua/5.1

#lua
rm -rf  /usr/local/share/lua/5.1
mkdir -p /usr/local/share/lua/
ln -sf /usr/local/luarocks/share/lua/5.1/ /usr/local/share/lua/5.1

ln -s /usr/local/nginx/luajit/bin/luajit /usr/local/bin/